﻿using System;
using System.Windows.Forms;

namespace Latin_Vocabulary_Indicator
{
    public partial class option : Form
    {
        private Form _caller;
        public option(Form caller)
        {
            InitializeComponent();
            _caller = caller;
            string[] inputer = fileOperator.textInput("Latin\\options.ini").Split('\r');
            startf.Value =Convert.ToByte(inputer[0].Split(':')[1]);
            increas.Value = Convert.ToByte(inputer[1].Split(':')[1]);
            decreas.Value = Convert.ToByte(inputer[2].Split(':')[1]);
            pointreq.Value = Convert.ToByte(inputer[3].Split(':')[1]);
        }

        private void yes_Click(object sender, EventArgs e)
        {
            if (pointreq.Value <= startf.Value) { MessageBox.Show("Non Refero Statuo Est Statio");return; }
            fileOperator.textOutput("Latin\\options.ini", "Start from: " + startf.Value +
                "\r\nIncreasement: " + increas.Value + 
                "\r\nDecreasement: " + decreas.Value +
                "\r\nReview point required: " + pointreq.Value);
            cancel_Click(null, null);
        }

        private void cancel_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void option_FormClosing(object sender, FormClosingEventArgs e)
        {
            _caller.Enabled = true;
            _caller.Focus();
        }
    }
}
